package com.tjcu.action;

import com.opensymphony.xwork2.ActionSupport;
import com.tjcu.entity.City;
import com.tjcu.service.CityService;
import com.tjcu.service.impl.CityServiceImpl;

import java.util.List;

/**
 * @author 王恒杰
 * @version 1.0
 * @date 2021/11/1 17:08
 * @email 1078993387@qq.com
 * @Address 天津
 * @Description:
 */
public class CityAction extends ActionSupport {
    private City city;
    private  List<City> cities;

    public String insertCity() {
        CityService cityService = new CityServiceImpl();
        city.setCid(null);
        cityService.insertCity(city);
       return  SUCCESS;
    }

    public String deleteCity() {
        CityService cityService = new CityServiceImpl();
        cityService.deleteCity(city.getCid());
        return  SUCCESS;
    }

    public String selectCity() {
        CityService cityService = new CityServiceImpl();
         cities = cityService.selectCity();
        return SUCCESS;
    }

    public City getCity() {
        return city;
    }

    public void setCity(City city) {
        this.city = city;
    }

    public List<City> getCities() {
        return cities;
    }

    public void setCities(List<City> cities) {
        this.cities = cities;
    }
}
